package com.thor.palmmall.rest.hdmall.sales.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.hdmall.sales.HDMDateRange;
import com.thor.palmmall.rest.hdmall.sales.MDateRange;

/**
 * @author:liyang
 * @time:2017年7月25日 下午4:13:55
 * @since:1.0
 */
public class HDMDateRangeConverter implements Converter<MDateRange, HDMDateRange> {
  public static HDMDateRangeConverter getInstance() {
    if (instance == null)
      instance = new HDMDateRangeConverter();
    return instance;
  }

  private static HDMDateRangeConverter instance;

  private HDMDateRangeConverter() {
  }

  @Override
  public HDMDateRange convert(MDateRange source) {
    if (source == null) {
      return null;
    }
    HDMDateRange dest = new HDMDateRange();
    dest.setBeginDate(source.getBeginDate());
    dest.setEndDate(source.getEndDate());
    return dest;
  }

}
